
function copyCode(obj)
{
	var rng = document.body.createTextRange();
	rng.moveToElementText(obj);
	rng.select();
	rng.execCommand("Copy");
}

function saveCode(obj, filename)
{
	var winname = window.open('', '_blank', 'top=10000');
	winname.document.open('text/html', 'replace');
	winname.document.writeln(obj.value);
	winname.document.execCommand('saveas','', filename);
	winname.close();
}

function toHTML(s)
{
	s = s.split("&").join("&amp;");
	s = s.split("<").join("&lt;");
	return s.split(">").join("&gt;");
}
